/**
 * 
 * @param date 
 * @returns 
 */
export function formatterDate(
    date: any,
    format: string = ''
): string {
    let d = new Date(date)
    let f = format.toLocaleLowerCase()
    if (isNaN(d.getTime())) {
        return date
    }
    let y = oneToTwo(d.getFullYear())
    let m = oneToTwo(d.getMonth() + 1)
    let dd = oneToTwo(d.getDate())
    let h = oneToTwo(d.getHours())
    let mm = oneToTwo(d.getMinutes())
    let s = oneToTwo(d.getSeconds())
    f = f.replace('yyyy', y)
    f = f.replace('mm', m)
    f = f.replace('dd', dd)
    f = f.replace('hh', h)
    f = f.replace('mm', mm)
    f = f.replace('ss', s)
    return f
}
/**
 * @desc 数字2位表示
 * @param num any
 * @returns any
 */
export function oneToTwo(
    num: any
): any {
    let n = Number(num)
    return n >= 10 ? n : `0${n}`
}